package com.qf.controller;

import com.qf.pojo.reqVo.PayReq;
import com.qf.pojo.resVo.BaseResult;
import com.qf.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RequestMapping("/pay")
@RestController
public class PayController {

    @Autowired
    PayService payService;

    @RequestMapping("/alipay")
    public BaseResult alipay(@RequestBody PayReq payReq, HttpServletRequest request){
      return   payService.pay(payReq,request);
    }

    /**
     * 接收支付宝的回调请求
     */
    @RequestMapping("/returnUrl")
    public void returnUrl(HttpServletRequest request){
        payService.returnUrl(request);
    }
}
